#ifndef __X86_H
#define __X86_H

static __inline__ void outb(unsigned short port, unsigned char val)
{
        asm volatile("outb %0,%1"::"a"(val), "Nd" (port));
}       
        
static __inline__ unsigned char inb(unsigned short port)
{       
        unsigned char ret;
        asm volatile ("inb %1,%0":"=a"(ret):"Nd"(port));
        return ret;
}

static __inline__ void cli()
{
	asm volatile("cli");
}

static __inline__ void hlt()
{
	asm volatile("hlt");
}

static __inline__ void sti()
{
	asm volatile("sti");
}

extern unsigned long get_esp();
extern void reboot();

typedef struct regs
{
	unsigned int gs, fs, es, ds;
	unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
	unsigned int int_no, err_code;
	unsigned int eip, cs, eflags, useresp, ss;
} regs_t;

void irq_install_handler(int irq, void (*handler)(regs_t *r));
void irq_uninstall_handler(int irq);

#endif
